/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.capex.javacore.hilos;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Acer
 */
public class Thread1 extends Thread implements Runnable {

    String pingpong;

    public Thread1() {
        pingpong = "PingPong";
    }

    public Thread1(String w) {
        pingpong = w;
    }

    @Override
    public void run() {
        while (true) {
            System.out.println(pingpong);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException ex) {
                System.out.println(ex.getMessage());
            }
        }
    }

    public static void main(String[] args) throws InterruptedException {
        Thread1 hilo = new Thread1("Ping");
        Thread1 hilo2 = new Thread1("Pong");

        hilo.start();
        Thread.sleep(500);
        hilo2.start();

    }

}